home *** CD-ROM | disk | FTP | other *** search
- /*
- * Test returning a string qualifier from an external function for ProIcon
- *
- * This code resource will appear under the resource type 'TEST', ID 1004,
- * name "Substring Test". Invoke with:
- *
- * callout("TEST", "String Test")
- */
-
-
- #include "ProIcon.h"
-
- /*
- * Code resource called as:
- * callout("type", "resource name", ...)
- * where:
- * "type" is a Macintosh 4-character resource type code
- * "resource name" is a string used to specify resource by name.
- * ... are additional arguments whose dptrs are pushed on the stack.
- *
- * dargv[0] - Arg0 - descriptor to place result
- * dargv[1] - Arg1 - first user argument
- * dargv[argc] - Argn - last user argument
- * ip - pointer to integer used to signal error. *ip is initialized
- * to -1, signifying no error.
- *
- * Possible returns:
- * Success - Leave *ip unaltered, return descriptor pointer.
- * Failure - Leave *ip unaltered, return NULL.
- * Error - Set *ip to error code >= 0. Return descriptor pointer or NULL
- * to have value displayed or not displayed in error message.
- */
-
- #define resultstr "This is a test string"
- #define resultlen (sizeof(resultstr) - 1)
-
- pascal dptr main(dargv, argc, ip, callback) /* string() */
- dptr dargv;
- short int argc;
- short int *ip;
- pointer (*callback)();
- {
- if (argc != 0)
- Fail;
-
- if (strreq(resultlen) == Error) /* make sure space available */
- RunErr(0, NULL);
- StrLoc(Arg0) = alcstr(resultstr, (word)resultlen); /* allocate and copy string */
- StrLen(Arg0) = resultlen; /* set string length in qualifier */
-
- Return;
- }
-